-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Fix warnings #2881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix warnings #2881
Conversation
Codecov Report@@ Coverage Diff @@
## master #2881 +/- ##
==========================================
+ Coverage 27.8% 27.82% +0.01%
==========================================
Files 20 20
Lines 3625 3626 +1
Branches 656 656
==========================================
+ Hits 1008 1009 +1
Misses 2441 2441
Partials 176 176
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning up the warnings!
I wonder if we can tweak build flags when doing Travis build to error out on warnings in the first place...
Just a few notes about struct initializers — i think memset will be a better option, as the current way doesn't look very maintainable :)
@@ -49,7 +49,7 @@ class SPIFFSImpl : public FSImpl | |||
{ | |||
public: | |||
SPIFFSImpl(uint32_t start, uint32_t size, uint32_t pageSize, uint32_t blockSize, uint32_t maxOpenFds) | |||
: _fs({0}) | |||
: _fs{{0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we remove this initializer and use memset instead?
@@ -176,7 +176,7 @@ class SPIFFSImpl : public FSImpl | |||
|
|||
bool _tryMount() | |||
{ | |||
spiffs_config config = {0}; | |||
spiffs_config config = {0, 0, 0, 0, 0, 0, 0, 0}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here — memset will look slightly cleaner
@@ -268,7 +273,7 @@ class SPIFFSFileImpl : public FileImpl | |||
SPIFFSFileImpl(SPIFFSImpl* fs, spiffs_file fd) | |||
: _fs(fs) | |||
, _fd(fd) | |||
, _stat({0}) | |||
, _stat{0, 0, 0, 0, {0}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise
@@ -376,7 +381,7 @@ class SPIFFSFileImpl : public FileImpl | |||
auto rc = SPIFFS_fstat(_fs->getFs(), _fd, &_stat); | |||
if (rc != SPIFFS_OK) { | |||
DEBUGV("SPIFFS_fstat rc=%d\r\n", rc); | |||
_stat = {0}; | |||
_stat = {0, 0, 0, 0, {0}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise
This should be removed when the ESP8266 core is updated in PlatformIO: esp8266/Arduino#2881
This should be removed when the ESP8266 core is updated in PlatformIO: esp8266/Arduino#2881
Hello!
I fixed some warnings related to unused variables and uninitialized fields. I think not everyone is Core developer, so users should not see warnings in Core code when they compile their sketches. Related issue: #2587.